package com.aaa.sbms.controller;

import com.aaa.sbms.service.RDMService;
import com.aaa.sbms.util.SessionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.Map;

@RestController
@RequestMapping("rdm")
public class RDMController {
    @Autowired
    private RDMService rdmService;

    @RequestMapping("rdmList")
    public  Object list(@RequestParam Map map){
        return rdmService.getList(map);
    };

    @RequestMapping("updateIng")
    public  Object updateIng(Integer USERID){
        return rdmService.updateIng(USERID);
    }

    @RequestMapping("backIng")
    public  Object backIng(Integer USERID){
        return rdmService.backIng(USERID);
    }

    @RequestMapping("add")
    public Object addRoom(@RequestBody Map map, HttpSession session){
        map.put("userName", SessionUtil.getUserName());
        return rdmService.addBedCount(map);
    };
}
